package com.small.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.small.R;
import com.small.model.ShopBaseInfoModel;

public class ShopContactListAdapter extends BaseAdapter{

	List<ShopBaseInfoModel> shopList;
	LayoutInflater li;
	public ShopContactListAdapter(Context co,ArrayList<ShopBaseInfoModel> shopList2){
		this.li=LayoutInflater.from(co);
		shopList=shopList2;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return shopList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
//		// TODO Auto-generated method stub
//		convertView=null;
//		convertView=li.inflate(R.layout.mylook_list_item, null);
//		ImageView img=(ImageView)convertView.findViewById(R.id.itme_btn);
//		TextView txt_name=(TextView)convertView.findViewById(R.id.itme_txt);
//		
		ShopBaseInfoModel  item= shopList.get(position);
		 
		ViewHolder holder=null; 
			
			if(null==convertView){
				holder =new ViewHolder();  
				convertView=li.inflate(R.layout.activity_shopaddress_list_item, null);
				holder.tv_shopname = (TextView) convertView.findViewById(R.id.shop_name);     
		        holder.tv_shopaddress = (TextView) convertView.findViewById(R.id.shop_address); 
		        convertView.setTag(holder);
			}else {
				holder = (ViewHolder) convertView.getTag();
			} 
			 
			holder.tv_shopname.setText(item.getShopName());
			holder.tv_shopaddress.setText(item.getShopAddress());
			  
		
		return convertView; 		
	}
	private  class ViewHolder {    
    	public TextView tv_shopname;
    	public TextView tv_shopaddress;
    	 
	}
}
